#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/wait.h>
#include <string.h>

int main()
{
	int fds[2];
	pipe(fds);

	if(fork()==0)
	{
		dup2(fds[1],1);
		close(fds[0]);
		execlp("ls","ls","-l",NULL);
		perror("execlp");
		exit(1);
	}
	else
	{
		dup2(fds[0],0);
		close(fds[1]);
		execlp("wc","wc","-l",NULL);
		perror("execlp");
		exit(1);
	}
}
